package com.hezhanying.mapper;

import com.hezhanying.pojo.Emp;
import org.apache.ibatis.annotations.*;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface EmpMapper {
    @Insert("insert into emp(username,name,gender,image,job,entrydate,dept_id,create_time,update_time) values(#{username},#{name},#{gender},#{image},#{job},#{entrydate},#{deptId},#{createTime},#{updateTime})")
    void addEmp(Emp emp);
    @Delete("delete from emp where id = #{id}")
    void deleteEmp(Integer id);
    @Update("update emp set username=#{username},name=#{name},gender=#{gender},image=#{image},job=#{job},dept_id=#{deptId},update_time=#{updateTime} where id = #{id}")
    void updateEmp(Emp emp);
    List<Emp> getAllEmp(String name, Short gender, LocalDate begin, LocalDate end);

    @Select("select * from emp where username = #{username} and password=#{password}")
    Emp getByUsernameAndPassword(Emp emp);
}
